import Vue from "vue";
import VueRouter from "vue-router";
import UserLogin from "@/views/UserLogin.vue";
import PageIndex from "@/views/PageIndex.vue";
import UserRegist from "@/views/UserRegist.vue";
import ManagerIndex from "@/views/ManagerIndex.vue";
import ManageUser from "@/views/ManageUser.vue";
import UserPage from "@/views/UserPage.vue";
import UserEdit from "@/views/UserEdit.vue";
import ManageProduct from "@/views/ManageProduct.vue";
import ProductPage from "@/views/ProductPage.vue";
import ProductEdit from "@/views/ProductEdit.vue";
import ProductAdd from "@/views/ProductAdd.vue";
import ManageAddress from "@/views/ManageAddress.vue";
import AddressPage from "@/views/AddressPage.vue";
import AddressAdd from "@/views/AddressAdd.vue";
import AddressEdit from "@/views/AddressEdit.vue";
import NewsPage from "@/views/NewsPage.vue";
import AddNews from "@/views/AddNews.vue";
import UpdateNews from "@/views/UpdateNews.vue";
import CategoryPage from "@/views/CategoryPage.vue";
import AddCagegory from "@/views/AddCagegory.vue";
import UpdateCategory from "@/views/UpdateCategory.vue";
import UpdateUserJ from "@/views/UpdateUser-j.vue";
import ManagerNews from "@/views/ManagerNews.vue";
import ManageCategory from "@/views/ManageCategory.vue";
import UpdateUserPassword from "@/views/UpdateUserPassword.vue";
import UpdateUser from "@/views/UpdateUser.vue";
import MyOrderPage from "@/views/MyOrderPage.vue";
import ManageOrder from "@/views/ManageOrder.vue";
import AllOrderPage from "@/views/AllOrderPage.vue";
import NewsDetail from "@/views/NewsDetail.vue";
import ProductCategory from "@/views/ProductCategory.vue";
import ProductOfCategory from "@/views/ProductOfCategory.vue";
import ProductDetail from "@/views/ProductDetail.vue";
import WeChatPay from "@/views/WeChatPay.vue";
import ManageCollect from "@/views/ManageCollect.vue";
import ManagerMySelf from "@/views/ManagerMySelf.vue";



Vue.use(VueRouter);

const routes = [
  {
    path: "/updateUser",
    component: UpdateUser,
    children:[
    {
        path: "",
        component: UpdateUserJ,
      },
      {
        path: "updateUserPassword",
        name: "updateUserPassword",
        component: UpdateUserPassword,
      },
]
  },
  {
    path: "/weChatPay",
    name: "weChatPay",
    component: WeChatPay,
  },
  {
    path: "/",
    name: "productCategory",
    component: ProductCategory,
    children:[
      {
        path: "",
        name: "pageIndex",
        component: PageIndex,
      }, {
        path: "/categoryDetail",
        name: "productOfCategory",
        component: ProductOfCategory,
      },{
        path: "/productDetail",
        name: "productDetail",
        component: ProductDetail,
      },
    ]
  },
  {
    path: "/login",
    name: "userLogin",
    component: UserLogin,
  },
  {
    path: "/regist",
    name: "userRegist",
    component: UserRegist,
  },
  {
    path: "/managerIndex",
    name: "managerIndex",
    component: ManagerIndex,
    children: [
      {
        path: "manageUser",
        component: ManageUser,
        children: [
          {
            path: "",
            component: UserPage,
          },
          {
            path: "edit",
            name: "userEdit",
            component: UserEdit,
          },
        ],
      },{
        path:"managerMyself",
        name:"managerMyself",
        component: ManagerMySelf
      },
      {
        path: "manageCollect",
        component: ManageCollect,
      },
      {
        path: "manageProduct",
        component: ManageProduct,
        children: [
          {
            path: "",
            component: ProductPage,
          },
          {
            path: "edit",
            name: "productEdit",
            component: ProductEdit,
          },
          {
            path: "add",
            name: "productAdd",
            component: ProductAdd,
          },
        ],
      },
      {
        path: "manageOrder",
        component: ManageOrder,
        children: [
          {
            path: "myOrder",
            name: "myOrderPage",
            component: MyOrderPage,
          },
          {
            path: "allOrder",
            name: "allOrderPage",
            component: AllOrderPage,
          },
        ],
      },
      {
        path: "manageAddress",
        component: ManageAddress,
        children: [
          {
            path: "",
            component: AddressPage,
          },
          {
            path: "edit",
            name: "addressEdit",
            component: AddressEdit,
          },
          {
            path: "add",
            name: "addressAdd",
            component: AddressAdd,
          },
        ],
      },
      {
        path: "managerNews",
        component: ManagerNews,
        children: [
          {
            path: "",
            component: NewsPage,
          },
          {
            path: "update",
            name: "updateNews",
            component: UpdateNews,
            props: true,
          },
          {
            path: "add",
            name: "addNews",
            component: AddNews,
            props: true,
          },{
            path: "detail",
            name: "newsDetail",
            component: NewsDetail,
            props: true,
          },
        ],
      },
      {
        path: "managerCategory",
        component: ManageCategory,
        children: [
          {
            path: "",
            component: CategoryPage,
          },
          {
            path: "update",
            name: "updateCategory",
            component: UpdateCategory,
            props: true,
          },
          {
            path: "add",
            name: "addCategory",
            component: AddCagegory,
            props: true,
          },
        ],
      }
    ],
  },
];

const router = new VueRouter({
  routes,
  strict: true,
});

export default router;
